home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Tele
/
C
/
Comet2.1.3.cpt
/
3270XCMD
/
TNStatus.c
< prev
next >
Wrap
Text File
|
1990-03-21
|
2KB
|
118 lines
/* TNStatus.c -- XCMD to get TN3270 connection status
copyright 1989 Cornell University
*/
#include <Types.h>
#include <Memory.h>
#include <Devices.h>
#include <HyperXCmd.h>
#include <Errors.h>
#include <String.h>
#include "TNdrvr.h"
pascal void debugger() extern 0xA9FF;
pascal void TNStatus(hycp)
XCmdPtr hycp;
{
CntrlParam drvpb;
Str255 pstr;
if (hycp->paramCount != 1) {
sethand(&hycp->returnValue,
"TNStatus TNID: need 1 argument");
return;
}
HLock((Handle) hycp->params[0]);
ZeroToPas(hycp, *hycp->params[0], (StringPtr) &pstr[0]);
drvpb.ioCRefNum = (short) StrToNum(hycp, (Str31 *) &pstr[0]);
drvpb.csCode = HTN_STATUS;
PBControl((ParmBlkPtr) &drvpb, (Boolean) 0);
if (drvpb.ioResult) {
/* maybe an error, maybe a status result */
switch (drvpb.ioResult) {
case HTNR_NOTN: {
sethand(&hycp->returnValue, "TN is not running");
break;
}
case HTNR_ACTIVE: {
sethand(&hycp->returnValue, "TN not opened");
break;
}
case HTNR_OPEN: {
sethand(&hycp->returnValue, "TN has no connection");
break;
}
case HTNS_RUNNING: {
sethand(&hycp->returnValue, "");
break;
}
case HTNS_WAITCONN: {
sethand(&hycp->returnValue, "TN waiting for connection");
break;
}
case HTNS_WAITNET: {
sethand(&hycp->returnValue, "TN waiting on network");
break;
}
case HTNS_NEWDATA: {
sethand(&hycp->returnValue, "New Data");
break;
}
case HTNS_KBDLOCK: {
sethand(&hycp->returnValue, "Keyboard locked");
break;
}
case HTNS_MORE: {
sethand(&hycp->returnValue, "More...");
break;
}
case HTNS_HOLDING: {
sethand(&hycp->returnValue, "HOLDING");
break;
}
case HTNS_CP: {
sethand(&hycp->returnValue, "CP");
break;
}
case HTNS_VMREAD: {
sethand(&hycp->returnValue, "VM READ");
break;
}
case badUnitErr: {
sethand(&hycp->returnValue, "TNID is incorrect");
break;
}
default: {
sethand(&hycp->returnValue, "Unknown error");
break;
}
}
}
HUnlock((Handle) hycp->params[0]);
}
sethand(thand, str)
Handle * thand;
char * str;
{
if (*thand == NULL) {
*thand = NewHandle((Size) 0);
}
SetHandleSize(*thand, (long) (strlen(str) + 1));
strcpy(**thand, str);
}
#include <XCmdGlue.inc.c>